<!DOCTYPE html>
<html>
<head>
    <!--    <meta http-equiv="refresh" content="1;url=main.html">-->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>首页</title>
</head>
<body>
    <h1>太好了</h1>
    <a href="/testJSON" target="_blank">testJSON</a>
    <div>
        email: <input id="email" value="293440@qq.com"/>
        message: <input id="message" value="太好了"/>
        <button onclick="testJSON();">提交</button>
    </div>
</body>
<script src="js/jquery.3.2.1.min.js"></script>
<script>
    function testJSON() {
        $.ajax({
            //asnyc: false,
            type: 'get',
            url: '/testJSON',
            data: {
                email: $('#email').val(),
                message: $('#message').val()
            },
            contentType: "application/json;charset=utf-8",
            success: function (data) {
                alert(data.message);
            },
            error: function (e) {
                alert("操作执行异常：" + JSON.stringify(e));
            }
        });
    }
</script>
</html>